package org.karelun.gef.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.karelun.gef.helper.ConstantMessages;
import org.karelun.gef.helper.IDConstant;

public class ShowOutlineView extends Action{
	
	private static final String id="org.karelun.gef.showOutline"; //$NON-NLS-1$
	
	private IWorkbenchWindow window;
	
	public ShowOutlineView(IWorkbenchWindow window){
		this.window=window;
		setId(id);
		setImageDescriptor(null);
		setText(ConstantMessages.ShowOutlineAction_Text);
	}
	
	public void run(){
		if(window==null)
			return;
		IWorkbenchPage page = window.getActivePage();
		try {
			page.showView(IDConstant.outlineId);
		} catch (PartInitException e) {
			e.printStackTrace();
		}
	}
}
